package com.wdb007.venus.svc.facade;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

import com.alibaba.fastjson.JSONObject;
import com.wdb007.venus.svc.facade.book.model.BookCommentsAndUserDTO;
import com.wdb007.venus.svc.facade.book.model.BookCommentsInsertDTO;
import com.wdb007.venus.svc.facade.book.model.BookCommentsQueryPageDTO;
import com.wdb007.venus.svc.facade.book.model.BookGridListDTO;
import com.wdb007.venus.svc.facade.book.model.BookGridListRequestModel;
import com.wdb007.venus.svc.facade.book.model.BookGridNotifyInventoryDTO;
import com.wdb007.venus.svc.facade.book.model.BookGridPageDTO;
import com.wdb007.venus.svc.facade.book.model.BookGridsDTO;
import com.wdb007.venus.svc.facade.book.model.BookQueryDTO;
import com.wdb007.venus.svc.facade.book.model.BookQueryPageDTO;
import com.wdb007.venus.svc.facade.book.model.BookRecommendationInfoDTO;
import com.wdb007.venus.svc.facade.book.model.BookShelfFavoriteDTO;
import com.wdb007.venus.svc.facade.book.model.BookShelfInfoDTO;
import com.wdb007.venus.svc.facade.book.model.BookTopicalAgeDTO;
import com.wdb007.venus.svc.facade.book.model.BookgridHardwareDTO;
import com.wdb007.venus.svc.facade.book.model.BookgridUnlockDTO;
import com.wdb007.venus.svc.facade.book.model.BorrowReturnBookDTO;
import com.wdb007.venus.svc.facade.book.model.BorrowedOrReturnBookResultDTO;
import com.wdb007.venus.svc.facade.book.model.BorrowedReturnBookResultDTO;
import com.wdb007.venus.svc.facade.book.model.BorrowedUserImgUrlDTO;
import com.wdb007.venus.svc.facade.book.model.PutonBook;
import com.wdb007.venus.svc.facade.book.model.PutonBookPageDTO;
import com.wdb007.venus.svc.facade.book.model.ShareBookDTO;
import com.wdb007.venus.svc.facade.book.model.ShelfBookInfoDTO;
import com.wdb007.venus.svc.facade.book.model.ShelfBookQueryDTO;
import com.wdb007.venus.svc.facade.book.model.SingleGridInventoryDTO;
import com.wdb007.venus.svc.facade.book.model.SingleGridReportDTO;
import com.wdb007.venus.svc.facade.book.model.SingleShelfInventoryDTO;
import com.wdb007.venus.svc.facade.book.model.SingleShelfReportDTO;
import com.wdb007.venus.svc.facade.exception.BizException;
import com.wdb007.venus.svc.facade.model.BookTagAgeDTO;
import com.wdb007.venus.svc.facade.model.VenusSvcResp;

public interface BookgridService {
	/**
	 * APP端  得到 借书/还书详细列表
	 * @param brBookDTO
	 * @return
	 */
	BorrowedReturnBookResultDTO getBrList(BorrowReturnBookDTO brBookDTO) throws BizException;

	/**
	 * APP端  得到 借书/还书详细列表
	 * @param brBookDTO
	 * @return
	 */
	BorrowedOrReturnBookResultDTO getBrListV2(BorrowReturnBookDTO brBookDTO) throws BizException;

	
	/**
	 * 调用开门API
	 * @param request
	 * @return
	 */
	BookgridUnlockDTO unlock(BookgridUnlockDTO request) throws BizException;
	
	/**
	 * 书柜通知后端，书格打开成功
	 * @param bookgridHardwareDTO
	 */
	void notifyUnlock(BookgridHardwareDTO bookgridHardwareDTO) throws BizException;
	/**
	 * 书柜通知后端，书格关闭成功
	 * @param bookgridHardwareDTO
	 */
	VenusSvcResp notifyLock(BookgridHardwareDTO bookgridHardwareDTO) throws BizException; 
	/**
	 * 查询书格状态
	 * @param gridCode
	 * @return
	 */
	Integer queryStatus(String gridCode) throws BizException;
	/**
	 * 查询该用户，该书格剩余可用时间
	 * @param gridCode
	 * @param userid
	 * @return 秒数
	 */
	Integer queryRemainingSeconds(String gridCode, Long userid) throws BizException;
	/**
	 * 单个书格进行盘点 用于智能书柜https接口使用
	 * @param singleGridInventory
	 */
	void singleGridInventory(SingleGridInventoryDTO singleGridInventory) throws BizException;
	/**
	 * 单书格进行盘点 用于推送服务器使用
	 * @param bookgrid_code
	 * @param rfidCodes
	 * @throws BizException
	 */
	String bookGridCheck(String bookgrid_code, List<String> rfidCodes) throws BizException;
	/**
	 * 单个书柜进行盘点
	 * @param inventory
	 */
	void singleShelfInventory(SingleShelfInventoryDTO inventory) throws BizException;
	
	void bookCaseCheck(JSONObject data) throws BizException;
	/**
	 * 单个书格状态汇报
	 * @param report
	 */
	void singleGridReport(SingleGridReportDTO report) throws BizException;
	
	String bookGridStatusReport(String bookgridCode, String status) throws BizException;
	/**
	 * 单个书柜状态汇报
	 * @param report
	 */
	void singleShelfReport(SingleShelfReportDTO report) throws BizException;
	 
	void bookCaseStatusReport(Map<String, String> statuses) throws BizException;
	
	
	boolean isUnderOpening(Long userid, Integer userType);
	/**
	 * 查看书柜状态是否正常,包括是否可用，是否已报修，已损坏
	 * @param gridCode
	 * @return 通过VenusSvcResp.getRspCodeEnum()是否为null，来判断是否正常
	 */
	VenusSvcResp<Boolean> isBookShelfNormal(String gridCode) throws BizException;
	/**
	 * 单书格定时盘点功能。由书柜调用
	 * @param inventory
	 */
	void singleGridTimeInventory(SingleGridInventoryDTO inventory) throws BizException;
	
	/**
	 * APP端通知服务端再次进行盘点接口开发
	 * @param notifyInventory
	 * @return
	 */
	VenusSvcResp<Object> notifyInventory(Long userId) throws BizException;
	
	
	BigDecimal getCostByUser(Long userid) throws BizException;
	
	
	PutonBook getPutonBookList(PutonBookPageDTO pageDTO) throws BizException;

	BookTagAgeDTO queryTagAgeList() throws BizException;

	BookQueryDTO queryBookList(BookQueryPageDTO bookQueryPageDTO) throws BizException;
	
	BookGridListDTO queryGridList(String shelfCode) throws BizException;
	
	PutonBook queryGridBooks(BookGridPageDTO pageDTO) throws BizException ;
	
	BookShelfInfoDTO queryBookInfo(ShelfBookInfoDTO requestDTO) throws BizException;

	PutonBook getRankBookList(PutonBookPageDTO pageDTO) throws BizException;
	
	List<BookRecommendationInfoDTO> queryBookBorrowCountAndRecommendation(BookQueryPageDTO query) throws BizException;
	
	BookTopicalAgeDTO queryTopicalAgeList() throws BizException;

	ShelfBookQueryDTO queryShelfBookList(BookQueryPageDTO bookQueryPageDTO) throws BizException;
	
	BorrowedUserImgUrlDTO getBorrowedUserImgUrl(String isbn) throws BizException;
	
	BookCommentsAndUserDTO queryComments(BookCommentsQueryPageDTO pageDTO) throws BizException;
	
	BookShelfFavoriteDTO queryMapShelfBook(String shelfCode, Long userId) throws BizException;
	
	void saveBookComments(BookCommentsInsertDTO bookComments) throws BizException;
	
	BookGridsDTO getGridList(BookGridListRequestModel requestModel) throws BizException;

	void unlockAll(Map<String, String> map) throws BizException;
	
	void bookGridStatusReportCron() throws BizException;
	
	String unlockFailed(String gridCode) throws BizException;
	
	void unlockOvertime(Long userid) throws BizException;
	
	ShareBookDTO shareBook(String isbn, Long userid) throws BizException;
	
	void shelfIsOpened(String shelfCode) throws BizException;
	
	String getGridCodeByIsbn(String shelfCode, String isbn) throws BizException;
	
	String getOverQuotaTip(Long userId) throws BizException;

	boolean gridIsInShelf(String gridCode, String shelfCode) throws BizException;
	/**
	 * 是否展示抽奖页面
	 * @param userId
	 * @return 0--不展示;1--展示
	 * @throws BizException
	 */
	Integer isShowDrawTip(Long userId) throws BizException;
	
	/**
	 * 是否有借阅记录
	 * @param userId
	 * @return
	 * @throws BizException
	 */
	Integer getCurrentDateReturnBookCount(Long userId) throws BizException;
	
}



